package org.deng.learn.webflux.util;

import org.deng.learn.webflux.exception.ValidException;

import javax.swing.*;
import java.util.stream.Stream;

/**
 * @author 邓力宾
 * @date 2020/12/21 10:40
 * @desc 参数校验工具类
 */
public class ValidUtils {
    private static final String[] INVALID_NAMES = {"admin", "guanliyuan"};
    /**
     * 校验名称
     * @param name
     */
    public static void valid(String name) {
        Stream.of(INVALID_NAMES).filter(n->n.equalsIgnoreCase(name)).findAny().ifPresent(n->{
            throw new ValidException("name", name);
        });
    }
}
